---
description: "Reference for Nitric's v0 .NET library - Returns a reference to a known version of a secret."
---

# .NET - Secret.Version()

Returns a reference to a known version of a secret.

```csharp
using Nitric.Sdk;
using Nitric.Sdk.Resource;

var keyRef = Nitric.Secret("encryptionKey").With(SecretPermission.Accessing);

var keyVersionRef = keyRef.Version("the-version-id");

Nitric.Run();
```

## Parameters

<Properties>
  <Property name="version" required type="string">
    The version ID. This value is returned from [secret.Put()](./secret-put).
  </Property>
</Properties>

## Examples

### Return a reference to a known secret version

```csharp
using Nitric.Sdk;
using Nitric.Sdk.Resource;

var keyRef = Nitric.Secret("encryptionKey").With(SecretPermission.Accessing);

var keyVersionRef = keyRef.Version("the-version-id");

Nitric.Run();
```

### Access the value of a known secret version

```csharp
using Nitric.Sdk;
using Nitric.Sdk.Resource;

var keyRef = Nitric.Secret("encryptionKey").With(SecretPermission.Accessing);

var keyVersionRef = keyRef.Version("the-version-id").Access();

keyVersionRef.ValueText;

Nitric.Run();
```

### See also

- [secret.Version.Access()](./secret-version-access)
